package net.xxcxcxcx.xc_enhancedmob.effect;

import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectType;
import net.xxcxcxcx.xc_enhancedmob.skills.Ref;

public class ProhibitionEffect extends StatusEffect implements effet {

    public ProhibitionEffect() {
        this(StatusEffectType.HARMFUL, 0xB80000);
    }

    protected ProhibitionEffect(StatusEffectType type, int color) {
        super(type, color);
    }

    @Override
    public boolean canApplyUpdateEffect(int duration, int amplifier) {
        return false;
    }

    @Override
    public boolean onTreat(LivingEntity mobEntity, Ref<Float> amount, int level) {
        if (level >= 9) return false;
        amount.setValue(amount.getValue() * (9 - level) * 0.1f);
        return true;
    }

    @Override
    public boolean onDamaged(LivingEntity attacker, LivingEntity target, DamageSource source, Ref<Float> amount, boolean ismob, boolean remote, int level) {
        amount.setValue(amount.getValue() * (1 + level * 0.1f));
        return true;
    }
}
